//
//  XHEditRecipeCollectionViewCell.m
//  meiang_edu
//
//  Created by 徐辉 on 2019/1/17.
//  Copyright © 2019年 com.meiang.meiang_edu. All rights reserved.
//

#import "XHEditRecipeCollectionViewCell.h"
#import "XHRecipeModel.h"

@interface XHEditRecipeCollectionViewCell()





@end

@implementation XHEditRecipeCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame])
    {
        [self addSubViews];
        self.contentView.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

- (void)addSubViews
{
    self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 102 * kScale, 68 * kScale)];
    
    [self.contentView addSubview:self.imageView];
    
    self.closeButton = [[UIButton alloc] initWithFrame:CGRectMake(102 * kScale-20, 0, 20, 20)];
    [self.closeButton setImage:[UIImage imageNamed:@"addImageView_close"] forState:UIControlStateNormal];
    self.closeButton.backgroundColor = [UIColor blackColor];
    self.closeButton.layer.cornerRadius = CGRectGetWidth(self.closeButton.bounds)/2;
    self.closeButton.layer.masksToBounds = YES;
    [self.contentView addSubview:self.closeButton];
    
    
    self.descLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 68 * kScale, 104 * kScale, 20*kScale)];
    self.descLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.descLabel];
}

- (void)setObject:(id)object
{
    XHRecipeModel * model = object;
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",IMG_OSS,model.ps_id]]];
    self.descLabel.text = model.ccaption;
    
}



@end
